package com.xiaobo.framework.kits;

import lombok.experimental.UtilityClass;

/**
 * @author: <a href="get_xiaobo@163.com">Josh_Xu</a>
 * @description:
 * @create: 2019-11-25 18:16
 **/
@UtilityClass
public class RegexKits {

    public String loadPublicKey(String publicKey) {
        String publicKeyPEM = publicKey.replaceAll("-----.+?PUBLIC.+?-----", "")
                .replaceAll("-----.+?PUBLIC.+?-----", "")
                .replaceAll("\\s", "");
        return publicKeyPEM;
    }

    public String loadPrivateKey(String privateKey) {
        String privateKeyPEM = privateKey.replaceAll("-----.+?PRIVATE.+?-----", "")
                .replaceAll("-----.+?PRIVATE.+?-----", "")
                .replaceAll("\\s", "");
        return privateKeyPEM;
    }
}
